from flask import Flask, request, jsonify, url_for, redirect
app = Flask(__name__)
@app.route('/')
def index():
    return '<h1>Hello World!</h1>'

@app.route('/hello/', methods=['GET'])
def hello():
    return '<h2>Hello World!</h2>'
@app.route('/hi/', methods=['POST'])
def hi():
    return '<h2>hi World!</h2>'

@app.route('/data/', methods=['POST'])
def process_data():
    data = request.json
    name = data['name']
    age = data['age']
    return f'Name: {name}, Age: {age}'

@app.route('/json', methods=['GET'])
def json():
    return jsonify(status=1, name="kkk", age=20)

@app.route('/helloworld', methods=['GET'])
def helloworld():
    return redirect(url_for('hello'))
    # return url_for('helloworld')
if __name__ == '__main__':
    app.run(host="0.0.0.0", port=8080, debug=True)
